package com.admission.util;

import org.apache.commons.lang.StringUtils;

public class NumGenerator {
	/**
	 * 生成序列码，当前号码加1，高位补0
	 * @param length
	 * @param preNum
	 * @return
	 */
	public static String getNextNum(int length, String preNum) {
		String result = "";
		if (StringUtils.isEmpty(preNum)) {
			for (int i = 0; i < length; i++) {
				result += "0";
			}
			return result;
		}
		int t = Integer.parseInt(preNum);
		t += 1;
		result = String.valueOf(t);
		for (int i = result.length(); i < length; i++) {
			result = "0" + result;
		}

		return result;

	}
	public static void main(String[] args) {
		System.out.println(getNextNum(8, "0001"));
	}

}
